<?php
namespace app\common\component\help_get;

use app\common\component\help_to\HelpToModel;

class HelpGetModel extends \think\Model {
	protected $table = 'league_help_get';
	
	public function getStatusAttr($value) {
		$status = [
			0 => '排队中',
			1 => '<span style="color: red">打款中</span>',
			2 => '<span style="color: purple">确认收款中</span>',
			3 => '未收到款',
			4 => '<span style="color: blue">提现完成</span>',
			9 => '可抢单'
		];
		return $status[$value];
	}
	
	public function getHelpToIdAttr($value) {
		if($value == 0) {
			return '';
		} else {
			$helpToModel = (new HelpToModel()) -> alias('h_t')
			-> join('league_user u', 'h_t.user_id = u.user_id')
			-> field('u.username, u.realname, u.phone, u.bank_code')
			-> where('h_t.help_to_id', $value) -> find();
			if($helpToModel) {
				return $helpToModel;
			} else {
				return '无';
			}
		}
	}
}
?>